www.gusucode.com > VC++ 打飞机游戏-源码程序 > VC++ 打飞机游戏-源码程序\code\src\MyButton.cpp
// MyButton.cpp : implementation file // Download by http://www.NewXing.com #include "stdafx.h" #include "fighter.h" #include "MyButton.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMyButton CMyButton::CMyButton() { } CMyButton::~CMyButton() { } BEGIN_MESSAGE_MAP(CMyButton, CButton) //{{AFX_MSG_MAP(CMyButton) // NOTE - the ClassWizard will add and remove mapping macros here. //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMyButton message handlers void CMyButton::SetMyBitmap(UINT nID) { m_bmp.LoadBitmap(nID); } void CMyButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { // TODO: Add your code to draw the specified item CDC dc; dc.Attach( lpDrawItemStruct->hDC ); CRect rc; GetClientRect(rc); CDC m_dc; m_dc.CreateCompatibleDC(&dc); m_dc.SelectObject(&m_bmp); if(lpDrawItemStruct->itemState & ODS_SELECTED) { dc.BitBlt(1, 1, 60, 25, &m_dc, 0, 0, SRCCOPY); } else { dc.BitBlt(0, 0, 60, 25, &m_dc, 0, 0, SRCCOPY); } }